The present invention relates to Gray Codes and their conversion to sign and magnitude representation.
Gray codes are used in flash ADCs (analogue to digital converters), which convert an analogue waveform into a sampled binary value. A known form of flash ADC is shown in FIG. 9. In this ADC 500 an analogue sample of waveform present at terminal 510 captured by sample and hold circuit 511 is input to the positive inputs of a set of typically 2N−1 comparators 502 (where N is an integer). The negative inputs of the comparators are respectively connected to taps between a chain of 2N series connected resistors 503 connected between the supply voltages. The resulting outputs from the comparators 502 form a thermometer code with is being output by all the adjacent comparators (those nearer the bottom in FIG. 9) having reference voltages less than the voltage of the waveform and 0s where they are greater (those near the top). One of the comparators at the boundary between the 1s and 0s may have a reference voltage very close to that of the waveform and so the output of that comparator may take a long time to settle, or even not resolve into a 1 or a 0 remaining at an intermediate voltage, or be unstable switching between 1 and 0. The thermometer code is latched into a register 504 under the control of a clock signal CLK. This latching does not cure the instability in the thermometer code however, which can propagate through the register 504. Next the thermometer code is converted into an N-bit Gray code, which represents 2N states, with a thermometer to Gray code logic block 505. (The Gray code therefore has fewer bits than the thermometer code.) The Gray code used is the “reflected” Gray code, which is the one in which to move from one code to the next the rightmost bit that can be changed while still producing a unique code. Since Gray codes have the property that successive values change by one bit, so the unstable bit of the thermometer code will only have a small effect on the value of the N-bit Gray code should the effects of its instability propagate through into the Gray code. Table 1 shows the corresponding values of the codes for the case N=4.
TABLE 1SignalThermometer CodeGray CodeBinary Codelevel*111111111111111100011111501111111111111110011110140011111111111111011110113000111111111111101011001200001111111111111101011110000011111111111111101010000000111111111110110019000000011111111110010008000000001111111010001117000000000111111010101106000000000011111011101015000000000001111011001004000000000000111001000113000000000000011001100102000000000000001000100011000000000000000000000000*taking a unit interval between thermometer codes and the zero level to be binary code 0000.
The Gray code is latched into anther register 506 under the control of the clock signal CLK. The Gray code is then converted with a Gray code to binary logic block 507 to a binary value (also shown in Table 1) which is then latched into another register 508 under the control of the clock signal CLK.
A problem with this circuit occurs in high data rate applications. Here the instability in the Gray code can propagate beyond register 506 and cause a large change in the value represented by the binary value output from logic block 507, which can then be latched by register 508. The present invention, in its preferred examples, aims to reduce this problem.